package com.manager.core.shiro.core.entity;

import com.manager.commons.utils.StringUtil;

import java.io.Serializable;
import java.util.List;

/**
 * 角色权限
 *
 * @author H
 */
public class ShiroRolePermission implements Serializable {

    /**
     *
     */
    private static final long serialVersionUID = 4491477997847399600L;
    /**
     * 角色code
     */
    private String roleCode;

    /**
     * 资源code
     */
    private String perCode;

    private String perAuth;

    private String perPath;

    private String perParent;

    private String perName;

    private String perIcon;

    private String perType;

    private int perSort;

    private Short perDisplay;

    private String perStatus;

    private String rpStatus;
    private String href;
    private int ppSub;
    private int ppLevel;
    private String ppIcon;
    private List<ShiroRolePermission> items;

    public String getRoleCode() {
        return roleCode;
    }

    public void setRoleCode(String roleCode) {
        this.roleCode = roleCode;
    }

    public String getPerCode() {
        return perCode;
    }

    public void setPerCode(String perCode) {
        this.perCode = perCode;
    }

    public String getPerAuth() {
        return perAuth;
    }

    public void setPerAuth(String perAuth) {
        this.perAuth = perAuth;
    }

    public String getPerPath() {
        return perPath;
    }

    public void setPerPath(String perPath) {
        this.perPath = perPath;
    }

    public String getPerParent() {
        return perParent;
    }

    public void setPerParent(String perParent) {
        this.perParent = perParent;
    }

    public String getPerName() {
        return perName;
    }

    public void setPerName(String perName) {
        this.perName = perName;
    }

    public String getPerIcon() {
        return perIcon;
    }

    public void setPerIcon(String perIcon) {
        this.perIcon = perIcon;
    }

    public String getPerType() {
        return perType;
    }

    public void setPerType(String perType) {
        this.perType = perType;
    }

    public int getPerSort() {
        return perSort;
    }

    public void setPerSort(int perSort) {
        this.perSort = perSort;
    }

    public Short getPerDisplay() {
        return perDisplay;
    }

    public void setPerDisplay(Short perDisplay) {
        this.perDisplay = perDisplay;
    }

    public String getPerStatus() {
        return perStatus;
    }

    public void setPerStatus(String perStatus) {
        this.perStatus = perStatus;
    }

    public String getRpStatus() {
        return rpStatus;
    }

    public void setRpStatus(String rpStatus) {
        this.rpStatus = rpStatus;
    }

    public List<ShiroRolePermission> getItems() {
        return items;
    }

    public void setItems(List<ShiroRolePermission> items) {
        this.items = items;
    }

    public ShiroRolePermission() {

    }

    public ShiroRolePermission(String roleCode, String perCode, String perParent, String perType) {
        this.roleCode = roleCode;
        this.perCode = perCode;
        this.perParent = perParent;
        this.perType = perType;
    }

    public ShiroRolePermission(String roleCode, String perCode, String perPath, String perParent, String perName,
                               String perType, int perSort) {
        this.roleCode = roleCode;
        this.perCode = perCode;
        this.perPath = perPath;
        this.perParent = perParent;
        this.perName = perName;
        this.perType = perType;
        this.perSort = perSort;
    }

    public String getHref() {
        if (StringUtil.isNotEmpty(perPath)) {
            return perPath.replaceAll(":", "/");
        }
        // return perPath;
        return href;
    }

    public int getPpSub() {
        return ppSub;
    }

    public void setPpSub(int ppSub) {
        this.ppSub = ppSub;
    }

    public void setHref(String href) {
        this.href = href;
    }

    public int getPpLevel() {
        return ppLevel;
    }

    public void setPpLevel(int ppLevel) {
        this.ppLevel = ppLevel;
    }

    public String getPpIcon() {
        return ppIcon;
    }

    public void setPpIcon(String ppIcon) {
        this.ppIcon = ppIcon;
    }
}